package cn.wolfcode.web.controller;

import cn.wolfcode.common.web.Result;
import cn.wolfcode.domain.OperateIntergralVo;
import cn.wolfcode.service.IUsableIntegralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lanxw
 */
@RestController
@RequestMapping("/intergral")
public class IntegralController {
    @Autowired
    private IUsableIntegralService usableIntegralService;

    @RequestMapping("/decrIntergral")
    Result decrIntergral(@RequestBody OperateIntergralVo vo){
        usableIntegralService.decrIntergral(vo);
        return Result.success("积分支付成功");
    }


    @RequestMapping("/incrIntergral")
    Result incrIntergral(@RequestBody OperateIntergralVo vo){
        usableIntegralService.incrIntergralTry(vo,null);
        return Result.success("积分回退成功");
    }
}
